package com.bwie.utils;

import lombok.Data;

@Data
public class R {
    private Integer code;
    private String msg;
    private Object data;

    public static R ok(){
        R r = new R();
        r.setCode(200);
        r.setMsg("操作成功");
        r.setData(null);
        return r;
    }

    public static R error(){
        R r = new R();
        r.setCode(500);
        r.setData(null);
        r.setMsg("操作失败");
        return r;
    }

    public Integer getCode() {
        return code;
    }

    public R setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public R setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public R setData(Object data) {
        this.data = data;
        return this;
    }
}
